
package com.jf.cloud.combo.feign;

import com.jf.cloud.api.combo.feign.ComboFeignClient;
import com.jf.cloud.combo.service.ComboService;
import com.jf.cloud.common.product.vo.ComboVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Hidden;

import java.util.List;

/**
 * @author zz
 * @date 2022/8/16 15:00
 */
@RestController
@Hidden
public class ComboFeignController implements ComboFeignClient {
    @Autowired
    private ComboService comboService;
    @Override
    public ServerResponseEntity<ComboVO> getComboWithProdInfoById(Long comboId, Integer sysType) {
        return ServerResponseEntity.success(comboService.getByComboId(comboId,sysType));
    }

    @Override
    public ServerResponseEntity<List<ComboVO>> listComboInfoBySpuId(Long shopId, Long spuId) {
        return ServerResponseEntity.success(comboService.listComboInfoBySpuId(shopId, spuId));
    }

    @Override
    public ServerResponseEntity<List<ComboVO>> comboVoListBySpuId(Long spuId) {
        return ServerResponseEntity.success(comboService.comboVoListBySpuId(spuId));
    }

    @Override
    public ServerResponseEntity<Void> offComboMainSpu(Long spuId) {
        comboService.offComboMainSpu(spuId);
        return ServerResponseEntity.success();
    }

    @Override
    public ServerResponseEntity<Boolean> checkComboSpu(Long spuId, Long shopId) {
        return ServerResponseEntity.success(comboService.checkComboSpu(spuId,shopId));
    }

    @Override
    public ServerResponseEntity<Integer> checkComboIsUsable(List<Long> comboIdList) {
        return ServerResponseEntity.success(comboService.checkComboIsUsable(comboIdList));
    }

    @Override
    public ServerResponseEntity<Void> removeComboSpuCache(Long spuId){
        comboService.removeComboSpuCache(spuId);
        return ServerResponseEntity.success();
    }
    @Override
    public ServerResponseEntity<List<ComboVO>> getComboByComboIdList( List<Long> comboIdList){
        return ServerResponseEntity.success(comboService.getComboByComboIdList(comboIdList));
    }

}
